//
//  LeftTableViewCell.m
//  Linkage
//
//  Created by LeeJay on 16/8/22.
//  Copyright © 2016年 LeeJay. All rights reserved.
//  代码下载地址https://github.com/leejayID/Linkage

#import "LeftTableViewCell.h"

@interface LeftTableViewCell ()

@property (nonatomic, strong) UIView *yellowView;

@end

@implementation LeftTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        _name = [[UILabel alloc] init];
//        self.name.numberOfLines = 0;
        _name.font = [UIFont systemFontOfSize:12];
        _name.textColor = YYTopMenuRgbColor(0x808080);
        _name.highlightedTextColor = YYTopMenuRgbColor(0x383838);
        [self.contentView addSubview:_name];
        _name.textAlignment = NSTextAlignmentCenter;
        [_name mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.contentView.mas_left).mas_offset(0);
            make.right.mas_equalTo(self.contentView.mas_right).mas_offset(0);
            make.centerY.mas_equalTo(self.contentView.mas_centerY).mas_offset(0);
        }];

//        self.yellowView = [[UIView alloc] initWithFrame:CGRectMake(0, 5, 5, 45)];
//        self.yellowView.backgroundColor = defaultColor;
//        [self.contentView addSubview:self.yellowView];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state

    self.contentView.backgroundColor = selected ? YYTopMenuRgbColor(0xE2E2E2) : YYTopMenuRgbColor(0xF1F1F1);
    self.highlighted = selected;
    self.name.highlighted = selected;
    self.yellowView.hidden = !selected;
}

@end
